<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<!-- 引入head中公共部分 -->
<head th:replace="header::header-commo(用户登录)"></head>
<script th:inline="javascript">
    //页面初始化
    $(function () {
        //点击刷新
        $("#showCode").click(function () {
            //创建时间对象
            var d = new Date();
            $(this).attr("src", [[${#request.contextPath}]] + "/captcha?d=" + d.getTime());
        });
    })
</script>
<body>
<!-- 引入头部导航-->
<header th:replace="header::header-nav"></header>
<!--登录区域-->
<div class="container-fluid" style="height:460px;background: url('/img/loginbg.jpg') no-repeat;">
    <div class="row">
        <div class="col-md-7">
        </div>
        <div class="col-md-5">
            <div class="panel panel-default" style="width: 400px; margin-top: 50px;">
                <div class="panel-heading">
                    <h3 class="panel-title">用户登录</h3>
                </div>
                <div class="panel-body">
                    <form class="form-horizontal" th:action="@{/user/login}" method="post">
                        <div th:if="${not #strings.isEmpty(error)}" class="alert alert-danger alert-dismissible" role="alert">
                            <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                                <span aria-hidden="true">&times;</span>
                            </button>
                            <span th:text="${error}">用户名或密码错误</span>
                        </div>
                        <div class="form-group">
                            <label for="username" class="col-sm-3 control-label">用户名:</label>
                            <div class="col-sm-7">
                                <input type="text" name="username" class="form-control" id="username" placeholder="请输入用户名">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="password" class="col-sm-3 control-label">密码:</label>
                            <div class="col-sm-7">
                                <input type="password" name="password" class="form-control" id="password" placeholder="请输入密码">
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="captcha" class="col-sm-3 control-label">验证码:</label>
                            <div class="col-sm-5">
                                <input type="text" name="captcha" class="form-control" id="captcha" placeholder="请输入验证码">
                            </div>
                            <div class="col-sm-4" style="padding: 0;">
                                <img id="showCode" th:src="@{/captcha}" src="/img/code.png"/>
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-sm-offset-3 col-sm-10">
                                <div class="checkbox">
                                    <label class="checkbox-inline">
                                        <input type="checkbox" value="true"/>记住用户名
                                        <a href="#">注册新用户</a>
                                    </label>
                                </div>

                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-offset-3 col-sm-7">
                                <input class="btn btn-success  btn-block" type="submit" value="登录" name="submit"/>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<!--底部-->
<footer th:replace="footer::footer-commo"></footer>

</body>

</html>